		var mapData;
	
		function loadAmap(data) {
			mapData = data;
			return searchAmap();
		}

		function searchAmap(paramCriteria) {
			clearTable();
			var data = mapData;
			var map = new AMap.Map('container', {
				resizeEnable : true,
				zoom : 8
			});
			var markers = [];
			var count = 0;
			for (var i = 0; i < data.length; i += 1) {
				var nameOfLocation = data[i].name;
				if (paramCriteria != undefined) {
					if (nameOfLocation.indexOf(paramCriteria) == -1) {
						continue;
					}
				}
				var ll = data[i].center;
				if(/null/i.test(ll)) {
					console.log("bad item: ", nameOfLocation, ll);
					continue;
				}
				insertTable(nameOfLocation, ll);
				var marker = new AMap.Marker({
					position : ll.split(','),
					title : data[i].center,
					offset : new AMap.Pixel(0, 0),
					map : map
				});
				markers.push(marker);
				count++;
				var _onClick = function(e) {
					window.open(e.target.getExtData());
				}
				var url = "http://lbs.amap.com/api/javascript-api/summary?&companyName="
						+ nameOfLocation;
				nameMarker = new AMap.Marker({
					content : "<div class = 'regular'>" + nameOfLocation + "</div>",
					position : ll.split(','),
					offset : new AMap.Pixel(20, 0),
					extData : url,
					map : map
				});
				AMap.event.addListener(nameMarker, 'click', _onClick);
				markers.push(nameMarker);
			}
			
			if (markers.length == 0) {
				//108.320004,22.82402, nanning
				var nanning = new AMap.Marker({
					title : "大南宁",
					position : [ 108.320004, 22.82402 ],
					map : map
				});
				markers.push(nameMarker);
			} else {
				map.setFitView();
			}
			console.log(111, count)
			return count;
		}

		function clearTable(name, location) {
			$("#detail tbody tr").remove();
		}

		function insertTable(name, location) {
			$("<tr></tr>").append("<td>" + name + "</td>")
                       .append("<td>" + location + "</td>")
                       .appendTo("#detail tbody");
		}